<?php

	// 登录验证
	session_start();
	if(!isset($_SESSION['user']) || !$_SESSION['user'])
	{
		header('Location: ../../login.html');
	}

	// 加载配置文件
	$conf = require('../../config.php');
	// 获取监听频率
	$refresh_speed = $conf['fpm']['refresh_speed'];
?>


<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>PHP-FPM 资源池</title>
		<link rel="stylesheet" href="../../src/css/fpm.css">
		<script type="text/javascript" src="../../src/js/jquery-1.8.2.js"></script>
		<script type="text/javascript" src="../../src/js/echarts-5.4.3.min.js"></script>
		<script type="text/javascript" src="../../src/js/fpm.js"></script>
		<script type="text/javascript">
		// 设置FPM版本
		var fpm_ver = '8210';
			// 从配置文件读取监听频率，并转化为毫秒
			var refresh_speed = parseInt("<?php echo $refresh_speed;?>");
			refresh_speed *= 1000;
		</script>
	</head>
	<body>
		<ul id="toolbar"></ul>
		<div id="pool_table">
			<table>
				<tr>
					<td colspan="2">
						进程池 <span id="pool_name"></span>
					</td>
				</tr>
				<tr>
					<td>类型</td>
					<td id="pool_type"></td>
				</tr>
				<tr>
					<td>启动时间</td>
					<td id="start_time"></td>
				</tr>
				<tr>
					<td>运行时长</td>
					<td id="running_time"></td>
				</tr>
				<tr>
					<td>已处理请求数</td>
					<td id="finished_request"></td>
				</tr>
				<tr>
					<td>排队待处理的请求数</td>
					<td id="penging_request"></td>
				</tr>
				<tr>
					<td>排队待处理请求峰值</td>
					<td id="peak_penging_request"></td>
				</tr>
				<tr>
					<td>待处理队列的最大长度</td>
					<td id="waiting_queue_max_length"></td>
				</tr>
				<tr>
					<td>空闲进程数</td>
					<td id="idle_processes"></td>
				</tr>
				<tr>
					<td>活动进程数</td>
					<td id="active_processes"></td>
				</tr>
				<tr>
					<td>总进程数</td>
					<td id="total_processes"></td>
				</tr>
				<tr>
					<td>并发活动进程峰值</td>
					<td id="peak_active_processes"></td>
				</tr>
				<tr>
					<td>进程池满载（达到最大子进程数）</td>
					<td id="pool_full"></td>
				</tr>
				<tr>
					<td>慢请求数量</td>
					<td id="slow_requests"></td>
				</tr>
			</table>
			<table name="process_list">
				<tr>
					<td colspan="6">进程列表</td>
				</tr>
				<tr>
					<td>进程PID</td>
					<td>状态</td>
					<td>启动时间</td>
					<td>运行时长</td>
					<td>已处理请求数</td>
				</tr>
			</table>
		</div>
		<div id="pool_chart"></div>
		<div id="goto_top" title="返回顶部"></div>
	</body>
</html>
